home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / CMPLTPAS / FASTINX.PAS < prev    next >
Pascal/Delphi Source File  |  1988-08-01  |  898b  |  40 lines

  1. PROGRAM FastIncrement;
  2.  
  3. USES Crt;
  4.  
  5. TYPE
  6.   IntArray = ARRAY[0..16000] OF Integer;
  7.  
  8. VAR
  9.   I      : Integer;
  10.   Scores : IntArray;
  11.  
  12.  
  13. PROCEDURE Increment(VAR Scores : IntArray;
  14.                     ByHowMuch  : Integer);
  15.  
  16. BEGIN
  17.   INLINE($C4/$BE/Scores/      {LES DI,[BP+<offset>]}
  18.          $B9/$80/$3E/         {MOV CX,16000}
  19.          $8B/$9E/ByHowMuch/   {MOV BX,ByHowMuch}
  20.          $26/$01/$1D/         {ADD ES:[DI],BX}
  21.          $47/                 {INC DI}
  22.          $47/                 {INC DI}
  23.          $E2/$FA);            {LOOP -6}
  24.  
  25. END;
  26.  
  27.  
  28. BEGIN
  29.   ClrScr;
  30.   { First, zero out the array: }
  31.   FillChar(Scores,SizeOf(Scores),Chr(0));
  32.   FOR I := 0 TO 10 DO
  33.     Writeln(Scores[I]);  { Show first ten values }
  34.   Readln;
  35.   Increment(Scores,72);  { Increment the array }
  36.   FOR I := 0 TO 10 DO
  37.     Writeln(Scores[I]);  { Show first ten values again }
  38.   Readln
  39. END.
  40.